.TH LDEV 8 2024-08-29 Lustre "Lustre Configuration Utilities"
.SH NAME
ldev \- lustre device utility
.SH SYNOPSIS
.SY ldev
.RI [ OPTIONS ]
.YS
.SH DESCRIPTION
.B ldev
can be used to query information about lustre devices configured in
/etc/ldev.conf. It is used by the lustre init script.
.SH OPTIONS
.B ldev
accepts the following options:
.TP
.BR -h ", " --help
Display help message.
.TP
.BR -c ", " --config \ \fIFILE
Set path to config file.
.TP
.BR -H ", " --hostname \ \fINAME
Use NAME instead of local hostname for queries.
.TP
.BR -p ", " --partner
Print hostname of failover partner.
.TP
.BR -l ", " --local
Print labels for local devices.
.TP
.BR -f ", " --foreign
Print labels for foreign devices.
.TP
.BR -a ", " --all
Print labels for local and foreign devices.
.TP
.BR -F ", " --filesys \ \fINAME
Print labels for file system NAME.
.TP
.BR -s ", " --sanity
Sanity check config on this node.
If any expected local or foreign devices are not present, print an error.
If devices do not contain the expected labels, print an error.
.TP
.BR -d ", " --device \ \fILABEL
Print storage device of label.
.TP
.BR -j ", " --journal \ \fILABEL
Print journal device corresponding to label if defined.
.TP
.BR -r ", " --raidtab \ \fILABEL
Print Linux software raid configuration file or ZFS cache file associated with
LABEL, if any. Using non-default names for these files may help prevent arrays
from being automatically started by the system. This is important in failover
configurations where the timing of device initialization must be strictly
controlled.
.TP
.BR -t ", " --type \ \fILABEL
Print device type of LABEL, i.e. "zfs" or "md".
.TP
.BR -z ", " --zpool \ \fILABEL
Print zpool containing LABEL.
.TP
.BR -R ", " --role \ \fIROLE
Filter output based on role, i.e. mdt, ost, mgs.
.TP
.IR CMD " [" ARGS ...]
Run one instance of
.IR CMD " [" ARGS ]
for each label in parallel.
Only the local labels are used by default, but foreign, all, or file system
labels may be selected by adding the
.BR --foreign ,
.BR --all ,
or
.B --filesys
options.
The following substitutions are made:
%f=fsname, %d=device, %j=journal, %i=index, %I=hex-index, %t=type, %l=label,
%n=nid, %N=failnid, %m=mgsnid, %H=hostname, %b=backing-fs. On failure of
any child processes,
.B ldev
will return a non-zero exit code.
.PP
It is an error if %n, %N, or %m is used in a command and /etc/nids does not
contain appropriate host to NID mappings.
.SH FILES
.EX
/etc/ldev.conf
/etc/nids
.EE
.SH EXAMPLES
To run a preen check on all devices in a cluster in parallel:
.RS
.EX
pdsh -S -g ost ldev fsck.ldiskfs -p %d
.EE
.RE
.PP
To re-format an entire file system:
.RS
.EX
\&#!/bin/bash -xe
export FANOUT=64
\&
\&# MDTs
.B # pdsh -S -g mds service lustre stop
.B # pdsh -S -g mds ldev "yes \e| mkfs.ldiskfs -q -b4096 -Ojournal_dev %j"
.B # pdsh -S -g mds ldev dd if=/dev/zero of=%d count=8
.B # pdsh -S -g mds ldev mkfs.lustre --mdt --mgs --fsname=%f \e
.B "        --index=%i" --mkfsoptions=-Jdevice=%j --mkfsoptions=-i2048 \e
.B "        --mountfsoptions=errors=panic,iopen_nopriv,user_xattr,\e"
.B "                         maxdirsize=20000000 %d"
.B # pdsh -S -g mds ldev tune.ldiskfs -i0 -m0 -c0 %d
\&
\&# OSTs
mgs=172.16.2.200@tcp0
.B # pdsh -S -g ost service heartbeat stop
.B # pdsh -S -g ost service lustre stop
.B # pdsh -S -g ost ldev dd if=/dev/zero of=%d count=8
.B # pdsh -S -g ost ldev mkfs.lustre --ost --mgsnode=$mgs --fsname=%f \e
.B "        --index=%i" --param=lov.stripecount=2 --failnode=%N \e
.B "        --mountfsoptions=errors=panic,extents,mballoc %d"
.B # pdsh -S -g ost ldev tune.ldiskfs -epanic -i0 -m0 -c0 %d
.EE
.RE
.SH AVAILABILITY
.B ldev
is part of the
.BR lustre (7)
filesystem package since release 0.8.0
.\" Added in commit 0.7.3
.SH SEE ALSO
.BR ldev.conf (5),
.BR nids (5)
